<?

include "constants.php";

function echoHeader($pageTitle) {
	echo "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>" .
		"<html>\n<head>\n<meta content='text/html; charset=ISO-8859-1' http-equiv='content-type'>\n" .
		"<title>" . TITLE_PREFIX . 
		" - $pageTitle</title>\n" .
		"<link rel='stylesheet' type='text/css' href='" . CSS . "' />\n" .
		"</head>\n<body>\n";
}

function echoFooter() {
	echo "\n\n<div id='footer'>\n";
	echoLegend();
	echo "\nDocument Manager | CS 4365 | Created by Jay Engler and Jon Cohen, 2010<br>\n" .
		"<a href='WorkflowTemplate_List.php'>Workflow Templates</a> | <a href='Document_List.php?userid=" . $_SESSION["userid"] . "'>My Documents</a> | <a href='Document_List.php'>All Documents</a> | <a href='index.php?action=logout'>Log Out</a>\n</div>";
	echo "\n\n</body>\n</html>";
}

function echoLegend()
{
	// write out the legend for the icons	
	echo "<img src='images/blue-plus.jpg' HEIGHT='30' WIDTH='30'> Create new item</img><br>";
	echo "<img src='images/green-checkmark.gif' HEIGHT='30' WIDTH='30'> Update current item </img><br>";
	echo "<img src='images/red-x.jpg' HEIGHT='30' WIDTH='30'> Delete current item </img><br><br>\n";
}

function sendMail($to, $subject, $message) {
	$subject = MAIL_PREFIX . $subject;
	$message .= "\n";
	$message = wordwrap($message, 70);
	$message = str_replace("\n.", "\n..", $message);
	$headers = "From: " . SERVER_MAIL_ADDRESS;
	return mail($to, $subject, $message, $headers);
}

?>